#ifndef _BUFFER_ERROR_POLICIES
#define _BUFFER_ERROR_POLICIES

// Default value for Reading from an empty buffer is nullptr
template<class T>
struct ReadErrorPolicyDefaultValue
{
	static T& HANDLE_ERROR()
	{
		return ReadErrorPolicyDefaultValue<T>::defaultValue;
	}

	static T defaultValue;
};
template<class T>
T ReadErrorPolicyDefaultValue<T>::defaultValue;

template<class T>
struct ReadErrorPolicyException
{
	struct Exception : public std::exception
	{
		virtual const char* what() const throw()
		{
			return "buffer is empty";
		}

	};

	static T& HANDLE_ERROR()
	{
		Exception excpt;
		throw excpt;
	}
};

template<class T>
struct WriteErrorPolicyException
{
	struct Exception : public std::exception
	{
		virtual const char* what() const throw()
		{
			return "buffer is full";
		}

	};

	static bool HANDLE_ERROR()
	{
		Exception excpt;
		throw excpt;
	}
};

template<class T>
struct WriteErrorPolicyIgnore
{
	static bool HANDLE_ERROR()
	{
		return false;
	}
};

template<class T>
struct WriteErrorPolicyOverride
{
	static bool HANDLE_ERROR()
	{
		return true;
	}
};

#endif /* _BUFFER_ERROR_POLICIES */
